<?php

function greengar_check_following($friendid, $userid, $app) {
    
    $isFollowing = greengar_check_relationship_following($userid, $friendid, $app, TRUE);
    $isFollower = greengar_check_relationship_following($friendid, $userid, $app, TRUE);
    
    
    
    if ($isFollowing && $isFollower) {
        $result = relationshipToArray($isFollowing);
        $result['relationship'] = 'both';
        return $result;
    } else {
        if ($isFollowing) {
            $result = relationshipToArray($isFollowing);
            $result['relationship'] = 'from';
        } else if ($isFollower) {
            $result = relationshipToArray($isFollower);
            $result['relationship'] = 'to';
        } else {
           return array(
            'guid' => -1,
            'relationship' => 'none'); 
        }
        
    }
    return $result;
}

?>